home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / tm121.zip / PATHINFO.TXT < prev    next >
Text File  |  1990-05-04  |  5KB  |  86 lines

  1.  
  2.              INFORMATION ON THE DOS ENVIRONMENT PATH STRING
  3.              ----------------------------------------------
  4.  
  5.         All versions of PC and MS DOS above 1.x maintain an area in
  6.    memory called the environment.  The environment contains a series of
  7.    text strings that are used by DOS and applications programs for
  8.    various purposes.  You can see what strings are currently in the
  9.    enviroment by typing SET and pressing <RETURN> from the DOS level.  As
  10.    a minimum, the environment will contain the string COMSPEC= followed
  11.    by a DOS directory path and (usually) COMMAND.COM.  Most hard disk
  12.    equipped machines will show the following COMSPEC string:
  13.  
  14.                        COMSPEC=C:\COMMAND.COM
  15.  
  16.         Other strings that frequently appear in the environment are the
  17.    PROMPT= and PATH= strings.  Control of the environment is effected
  18.    through the DOS SET command, which may be entered at the DOS level or
  19.    from a batch (like AUTOEXEC.BAT) file.  For example, if a user desired
  20.    that DOS used a copy of COMMAND.COM that was in a directory named
  21.    C:\DOS, he/she might place the command SET COMSPEC=C:\DOS\COMMAND.COM
  22.    in the AUTOEXEC.BAT file.  After booting, DOS would load COMMAND.COM
  23.    from C:\DOS each time it needed to reload the command interpreter.
  24.    All other copies of COMMAND.COM in the system would be superfluous and
  25.    ignored by DOS.
  26.  
  27.         One very useful string that can be placed in the DOS environment
  28.    by the user is the PATH= string.  When the name of an executable file
  29.    is issued from the DOS level, DOS will first look in the current
  30.    subdirectory for the file.  If it finds it, it loads and executes it
  31.    and all is fine.  If it cannot find the file in the current directory,
  32.    DOS will search the environment for the PATH= designator.  If one
  33.    exists, DOS will start searching the system directories that are in the
  34.    PATH= string for the executable file.  For example, suppose that
  35.    the AUTOEXEC.BAT contains the command SET PATH=C:\DOS;D:\UTIL;E:\JUNK.
  36.    Note that directory path names are separated by semicolons and can
  37.    (and should) include the drive designator.  Now further suppose that
  38.    the user is in a directory named D:\SOMENAME and desires to run the
  39.    program MYPROG.EXE but MYPROG.EXE is not resident in D:\SOMENAME.
  40.    When the user enters MYPROG, DOS, unable find it in the current
  41.    directory, starts searching the directories in the PATH= string
  42.    starting with C:\DOS.  If MYPROG.EXE was in D:\UTIL, DOS would load
  43.    and execute the program and D:\UTIL would be the active directory when
  44.    the program received control from DOS.  Obviously, if DOS cannot find
  45.    MYPROG.EXE in any of directories in the PATH= string, the message BAD
  46.    COMMAND OR FILENAME will be displayed.
  47.  
  48.         The exact same sequence is followed if a running program calls
  49.    DOS to execute a program but with one possible important difference.
  50.    For technical reasons, some programs (like ArcMaster) need to load a
  51.    secondary copy of COMMAND.COM and then pass the name of the program to
  52.    be executed to COMMAND.COM.  This is accomplished by searching the
  53.    environment string for the COMSPEC= string to locate COMMAND.COM,
  54.    changing to that directory, and telling DOS to load COMMAND.COM.  The
  55.    command passed to DOS might look somethin like this:
  56.  
  57.                          COMMAND.COM MYPROG.EXE
  58.  
  59.    This tells DOS to run COMMAND.COM and for COMMAND.COM to load and
  60.    execute MYPROG.EXE.  Even if MYPROG.EXE were located in the active
  61.    directory when the applications program passed this command to DOS,
  62.    COMMAND.COM might not find MYPROG.EXE because the applications program
  63.    switched to the directory where COMMAND.COM was located in order to
  64.    start things rolling.  Therefore, unless MYPROG.EXE was in a directory
  65.    contained in the PATH= string or in the same directory as COMMAND.COM,
  66.    DOS would not find it.
  67.  
  68.         Each Identifier in the DOS path string MUST be unique.  For
  69.    example, consider the path identifier C:\UTIL\DOS\MYDIR.  Placing
  70.    this string in the DOS path string will NOT automatically place the
  71.    the dirctories C:\UTIL and C:\UTIL\DOS in the DOS path.  Each must
  72.    be uniquely identified by the correct path name.  For each of these
  73.    directories to be identified in the DOS path, the following would
  74.    be entered:
  75.  
  76.                     C:\UTIL;C:\UTIL\DOS;C:\UTIL\DOS\MYDIR
  77.  
  78.  
  79.    Obviously, the PATH= string can contain other directory path names and
  80.    you may already have a PATH= command in your AUTOEXEC.BAT file.  If
  81.    so, just add the directory containing the archive system files to the
  82.    string.  For maximum speed, make it the first directory name in the
  83.    string.
  84.  
  85.  
  86.